import { getOrderListData } from '../../api/getOrderListData';
import { getUserListData } from '../../api/getUserList';


const setting = {
  state: {},
  mutations: {},
  actions: {
    getOrderListData({ commit, state }, payload) {
      const ERR_MSG = '获取列表失败！'
      return new Promise((resolve, reject) => {
        getOrderListData(payload).then(Response => {
        var {
          code = '',
          data = {},
          msg = ERR_MSG
        } = Response || {}
        if(code.toString() === '200')
      {
        resolve(data)
      }else{
        reject(msg || ERR_MSG)
      }
    }).catch(() => {
        reject(ERR_MSG)
      }
    )
    })
    },
    getUserListData({ commit, state }, payload) {
      const ERR_MSG = '获取列表失败！'
      return new Promise((resolve, reject) => {
        getUserListData(payload).then(Response => {
        var {
          code = '',
          data = {},
          msg = ERR_MSG
        } = Response || {}
        if (code.toString() === '200') {
        resolve(data)
      } else {
        reject(msg || ERR_MSG)
      }
    }).catch(() => {
        reject(ERR_MSG)
      })
    })
    }
  }
}

export default setting
